﻿<p>
    <FluentCheckbox Label="Double-click the text field to set Today's date" @bind-value="@DoubleClickToToday" />
</p>
<div style="display: flex; flex-direction:row; gap:10px; ">
    <div>
        <FluentDatePicker Label="Meeting date" @bind-Value="@SelectedValue" ReadOnly />
    </div>
    <div>
        <FluentDatePicker Label="Days view" AriaLabel="To" @bind-Value="@SelectedValue" DoubleClickToDate="@DoubleClickToDate" />
    </div>
    <div>
        <FluentDatePicker Label="Months view" AriaLabel="To" @bind-Value="@SelectedValue" View="CalendarViews.Months" DoubleClickToDate="@DoubleClickToDate" />
    </div>
    <div>
        <FluentDatePicker Label="Years view" AriaLabel="To" @bind-Value="@SelectedValue" View="CalendarViews.Years" DoubleClickToDate="@DoubleClickToDate" />
    </div>
</div>
<p>
    Selected Date: @(SelectedValue?.ToString("yyyy-MM-dd"))
</p>

@code
{
    private DateTime? SelectedValue = DateTime.Today.AddDays(-2);
    private DateTime? DoubleClickToDate = null;

    private bool DoubleClickToToday
    {
        get => DoubleClickToDate.HasValue;
        set => DoubleClickToDate = value ? DateTime.Today : null;
    }
}
